package com.hndfsj.minio.config;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.Date;

@ConfigurationProperties(
        prefix = "file.store.minio"
)
@Data
public class MinioProperties {
    private static final Long DAY_MILLIS = 86400000L;
    private String endpoint;
    private String bucket;
    private String accessKey;
    private String secretKey;
    private String tmpDir = "./tmp/";
    private Boolean tmpClean = true;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date tmpFirstCleanTime;
    private Long tmpCleanPeriod;
    private Long tmpAliveDuration;

    public MinioProperties() {
        this.tmpCleanPeriod = DAY_MILLIS;
        this.tmpAliveDuration = DAY_MILLIS;
    }

}
